<template>
	<view class="setting" :style="{minHeight: wHeight + 'px' }">
		<view class="setting-bj">
			<view class="setting-top">
				<view class="setting-userimage" @click="handleToRegister">
					<image :src="'http://gy.hyq.ink/' + personalInfo.invite_img" mode=""></image>
				</view>
				<view class="setting-user">
					<view class="userul">
						<view class="user">
							<text>{{personalInfo.nickname}}</text>
						</view>
						<view class="attestation">
							<text v-if="personalInfo.auth_status == 2">未实名</text>
							<text v-else>已实名</text>
						</view>
					</view>
					<view class="balance" @click="handleToBalance">
						<text>余额:{{personalInfo.money}}</text>
					</view>
				</view>
			</view>
			<view class="setting-sz" @click="handleToSetCenter">
				<text>设置</text>
				<image src="/static/image/srtting-xyy.png" mode=""></image>
			</view>
			<view class="setting-ding">
				<view class="ding-my"  @click="handleMyOrder">
					<view class="me">
						<text>我的订单</text>
					</view>
					<view class="ding-img">
						<image src="/static/image/icon-xyy.png" mode=""></image>
					</view>
				</view>
				<view class="ding-flex">
					<view class="ding-li">
						<view class="ding-li-text">
							<text>5</text>
						</view>
							<text class="state">待付款</text>
					</view>
					<view class="ding-li">
						<view class="ding-li-text">
							<text class="state">5</text>
						</view>
							<text class="state">待确认</text>
					</view>
					<view class="ding-li">
						<view class="ding-li-text">
							<text>5</text>
						</view>
							<text class="state">已完成</text>
					</view>
				</view>
			</view>
		</view>
		<view class="setting-vip">
			<view class="setting-left">
				<view class="setting-vip-img">
					<image src="/static/image/my-icon.png" mode=""></image>
				</view>
				<view class="setting-vip-text">
					<view class="setting-vip-hy">
						<text>VIP会员</text>
					</view>
					<view class="setting-vip-kt">
						<text>开通VIP享更多福利</text>
					</view>
				</view>
			</view>
			<view class="setting-zx" @click="handleMemberCenter">
				<text>会员中心</text>
			</view>
		</view>
		<view class="setting-sell"  @click="handleToCommodityList()">
			<view class="sell-my">
				<view class="me">
					<text>我要卖</text>
				</view>
				<view class="sell-img">
					<image src="/static/image/icon-xyy.png" mode=""></image>
				</view>
			</view>
			<view class="sell-flex">
				<view class="sell-li">
					<view class="sell-li-text">
						<text>5</text>
					</view>
					<text>可出售</text>
				</view>
				<view class="sell-li">
					<view class="sell-li-text">
						<text>5</text>
					</view>
					<text>待上架</text>
				</view>
				<view class="sell-li">
					<view class="sell-li-text">
						<text>0</text>
					</view>
					<text>上架中</text>
				</view>
				<view class="sell-li">
					<view class="sell-li-text">
						<text>0</text>
					</view>
					<text>待确认</text>
				</view>
				<view class="sell-li">
					<view class="sell-li-text">
						<text>0</text>
					</view>
					<text>已完成</text>
				</view>
			</view>
		</view>
		<view class="seting-bottomimg">
			<image src="/static/image/settimg-img.png" mode=""></image>
		</view>
		<!-- <button type="default" @click="logout">退出</button> -->
		<settinglist></settinglist>
	</view>
</template>

<script>
	import settinglist from '../../components/setting/settinglist.vue'
	export default {
		data() {
			return {
				wHeight: '',
				/** 个人信息 */
				personalInfo: {}
			}
		},
		onLoad() {
			this.init();
			this.wHeight = this.$store.state.ContentHeight - 45;
		},
		methods: {
			/** 获取个人信息 */
			getPersonalInfo() {
				this.$post(this.api.getPersonalInfo, {}, 'post', { token: uni.getStorageSync('token') }).then((res) => {
					this.personalInfo = res.data;
				}).catch((err) => {
					console.log(err)
				})
			},
			/** 初始化 */
			init() {
				this.getPersonalInfo();
			},
			// 跳转至我的订单
			handleMyOrder() {
				uni.navigateTo({
					url: './myOrder/index'
				})
			},
			// 跳转至会员中心
			handleMemberCenter() {
				uni.navigateTo({
					url: './memberCenter/index'
				})
			},
			// 跳转至登录页面
			handleToRegister() {
				// uni.navigateTo({
				// 	url: '../login/login/index'
				// })
			},
			// 跳转至余额页面
			handleToBalance() {
				uni.navigateTo({
					url: './accountBalance/index'
				})
			},
			// 跳转至设置中心
			handleToSetCenter() {
				uni.navigateTo({
					url: './setCenter/index'
				})
			},
			// 跳转至商品列表页面
			handleToCommodityList() {
				uni.navigateTo({
					url: './commodityList/index'
				})
			},
			// 退出
			logout() {
				uni.clearStorageSync('token');
				uni.navigateTo({
					url: '../login/login/index'
				})
			}
		},
		components:{
			settinglist
		}
	}
</script>

<style lang="less" scoped>
	.setting {
		background-color: #F7F7F7;
		.setting-bj {
			width: 100%;
			height: 394rpx;
			background: url(~@/static/image/setting-bj.png) center no-repeat;
			background-size: 100% 100%;
			.setting-top {
				padding: 130rpx 20rpx 40rpx 40rpx;
				display: flex;
				align-items: center;
				position: relative;
				.setting-userimage {
					width: 100rpx;
					height: 100rpx;
					image {
						width: 100%;
						height: 100%;
						border-radius: 50%;
					}
				}

				.setting-user {
					padding-left: 20rpx;

					.userul {
						display: flex;
						align-items: center;

						.user {
							text {
								font-size: 32rpx;
								color: #FFFFFF;
							}
						}

						.attestation {
							margin-left: 20rpx;
							width: 130rpx;
							height: 36rpx;
							background: #D2D2D2;
							border-radius: 18rpx;
							display: flex;
							align-items: center;
							justify-content: center;

							text {
								font-size: 26rpx;
								font-family: SourceHanSansCN;
								font-weight: 400;
								color: #FFFFFF;
							}
						}
					}

					.balance {
						text {
							font-size: 26rpx;
							color: #F2EADC;
						}
					}
				}
			}

			.setting-sz {
				position: absolute;
				top: 104rpx;
				right: 0rpx;
				width: 117rpx;
				height: 48rpx;
				background: #C5A36C;
				border-radius: 24rpx 0rpx 0rpx 24rpx;
				display: flex;
				align-items: center;
				justify-content: center;

				text {
					font-size: 26rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #FFFFFF;
				}

				image {
					margin-left: 14rpx;
					width: 11rpx;
					height: 19rpx;
				}
			}
		}

		.setting-ding {
			// height: 220rpx;
			box-sizing: border-box;
			background: #FFFFFF;
			box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(233, 228, 217, 0.48);
			border-radius: 10rpx;
			margin: 0 20rpx;
			padding: 10rpx 0 30rpx 0;
			.ding-my {
				display: flex;
				justify-content: space-between;
				border-bottom: 2rpx solid #D2D2D2;
				margin: 0 15rpx;
				padding: 16rpx 0 26rpx 12rpx;
				.me {
					text {
						font-size: 30rpx;
						font-family: Source Han Sans CN;
						font-weight: bold;
						color: #333333;
					}
				}

				.ding-img {
					image {
						width: 13rpx;
						height: 24rpx;
						margin-right: 8rpx;
					}
				}
			}

			.ding-flex {
				width: 100%;
				display: flex;
				justify-content: space-around;
				padding-top: 20rpx;
				.ding-li {
					text-align: center;
					text {
						font-size: 30rpx;
						font-family: Source Han Sans CN;
						font-weight: 500;
						color: #313131;
					}
					.ding-li-text {
						text {
							font-size: 30rpx;
							font-weight: 700;
							font-family: Source Han Sans CN;
							color: #313131;
						}
					}
				}
			}
		}

		.setting-vip {
			width: 710rpx;
			margin: 0 auto;
			margin-top: 130rpx;
			border-radius: 10rpx;
			background-color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 0;
			.setting-left {
				display: flex;
				align-items: center;
				padding-left: 20rpx;

				.setting-vip-img {

					image {
						width: 57rpx;
						height: 57rpx;
						border-radius: 50%;
					}
				}

				.setting-vip-text {
					padding-left: 20rpx;

					.setting-vip-hy {
						display: flex;
						align-items: center;

						text {
							font-size: 30rpx;
							font-family: Source Han Sans CN;
							font-weight: bold;
							color: #000000;
						}
					}

					.setting-vip-kt {
						display: flex;
						align-items: center;

						text {
							font-size: 22rpx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #666666;
						}
					}
				}
			}

			.setting-zx {
				width: 143rpx;
				height: 50rpx;
				background: linear-gradient(0deg, #CFA461 0%, #DCBB7E 100%);
				border-radius: 25rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-right: 30rpx;

				text {
					font-size: 24rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #FFFFFF;
				}
			}
		}

		.setting-sell {
			width: 712rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(233, 228, 217, 0.48);
			border-radius: 10rpx;
			margin: 0 auto;
			margin-top: 20rpx;
			padding: 20rpx 0;
			.sell-my {
				width: 682rpx;
				display: flex;
				justify-content: space-between;
				margin: 0 auto;

				.me {
					text {
						font-size: 30rpx;
						font-family: Source Han Sans CN;
						font-weight: bold;
						color: #333333;
					}
				}

				.sell-img {
					image {
						width: 13rpx;
						height: 24rpx;
					}
				}
			}

			.sell-flex {
				width: 682rpx;
				display: flex;
				justify-content: space-around;
				margin: 0 auto;
				padding-top: 20rpx;

				.sell-li {
					text-align: center;

					text {
						font-size: 26rpx;
						font-family: Source Han Sans CN;
						color: #313131;
					}

					.sell-li-text {
						text {
							font-size: 26rpx;
							font-family: Source Han Sans CN;
							color: #313131;
						}
					}
				}
			}
		}

		.seting-bottomimg {
			margin: 20rpx 20rpx 0;

			image {
				display: block;
				width: 100%;
				height: 181rpx;
			}
		}
	}
</style>
